package com.caiback.service.impl;

import com.caiback.mapper.PostMapper;
import com.caiback.pojo.FindPost;
import com.caiback.pojo.MarketPost;
import com.caiback.pojo.Post;
import com.caiback.pojo.RecruitPost;
import com.caiback.service.PostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PostServiceImpl implements PostService {

    @Autowired
    private PostMapper postMapper;

    @Override
    public int createPost(String sql, Post post) {
        return postMapper.createPost(sql, post);
    }

    @Override
    public List<Post> getPostsFind() {
        return postMapper.getPostsFind();
    }

    @Override
    public List<Post> getPostsRecruit() {
        return postMapper.getPostsRecruit();
    }

    @Override
    public List<Post> getPostsMarket() {
        return postMapper.getPostsMarket();
    }

    @Override
    public List<MarketPost> getPostsPageMarket(Integer userId) {
        List<MarketPost> posts = postMapper.getPostsPageMarket(userId);
        return posts;
    }

    @Override
    public List<FindPost> getPostsPageFind(Integer userId) {
        List<FindPost> posts = postMapper.getPostsPageFind(userId);
        return posts;
    }

    @Override
    public List<RecruitPost> getPostsPageRecruit(Integer userId) {
        List<RecruitPost> posts = postMapper.getPostsPageRecruit(userId);
        return posts;
    }

    @Override
    public int deletePost(Integer id, String postsname) {
        return postMapper.deletePost(id, postsname);
    }
}